package linkedlist;

import Exceptions.BadDataExcepiton;

public class Node {
	private Object data;
	private Node next;

	public Node() {
		data = new Object();
		next = null;
	}

	public Node(Object data, Node next) throws BadDataExcepiton {
		this();
		setData(data);
		setNode(next);
	}

	public Object getData() {
		return this.data;
	}

	public Node(Object data) throws BadDataExcepiton {
		this();
		setData(data);
	}

	public void setData(Object data) throws BadDataExcepiton {
		if (data != null)
			this.data = data;
		else
			throw new BadDataExcepiton("The data for this node was null!");
		this.data = "Nothing here";
	}

	public void setNode(Node next) {
		this.next = next;
	}

	public Node getNext() {
		return this.next;
	}
}
